home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK2.toast / Development Kits (Disc 2) / ScriptX / Documentation / Code Examples from Docs / langguid / chap_06 / xmpl_08.sx < prev    next >
Encoding:
Text File  |  1996-05-21  |  898 b   |  41 lines  |  [TEXT/ttxt]

  1. --<<<
  2. -- Kaleida Labs, Inc.
  3. -- Field Guide to the ScriptX Language
  4. -- chapter 6, example 8
  5.  
  6. -- here are some examples of class definitions that override init
  7.  
  8. class BlahShape (Rect)
  9. inst vars blahList
  10. inst methods
  11.     method init self #rest args -> (
  12.         self.blahList := new LinkedList
  13.         apply nextMethod self args
  14.     )
  15. end
  16.  
  17. class TextTable (ArrayList)
  18. inst vars recClass, columns, name
  19. inst methods
  20.     method init self #rest args \
  21.         #key columns:(10) tabClass: name:("noName") -> (
  22.             apply nextMethod self initialSize:(30) args
  23.             self.recClass := tabClass
  24.             self.name := name
  25.             self.columns := columns
  26.             return self
  27.     )
  28. end
  29.  
  30. class ArrowPresenter (TwoDPresenter)
  31. instance variables strokePaint, direction
  32. instance methods
  33.     method init self #rest args ->(
  34.         apply nextMethod self \
  35.             boundary:(new Rect x2:15 y2:15) args
  36.     self.strokePaint := blackBrush
  37.     self.direction := @up
  38.     return self
  39.     )
  40. end
  41. -->>>